package com.samphanie.ane.app.demo.log

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import com.samphanie.ane.app.R
import com.samphanie.ane.library.log.*

class AneLogDemoActivity : AppCompatActivity() {

    var viewPrinter: AneViewPrinter? = null

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_ane_log_demo)

        viewPrinter = AneViewPrinter(this)

        findViewById<View>(R.id.btn_log).setOnClickListener {
            printLog()
        }

        viewPrinter!!.viewProvider.showFloatingView()
    }

    private fun printLog() {
        // 自定义Log配置
        AneLogManager.getInstance().addPrinter(viewPrinter)
        AneLog.log(object : AneLogConfig() {
            override fun includeThread(): Boolean {
                return true
            }

            override fun stackTraceDepth(): Int {
                return 0
            }
        }, AneLogType.E, "------", "123456")
        AneLog.a("测试测试测试")
    }
}